package com.hqd.ch03.v23.aop.framework.aspectj;

import com.hqd.ch03.v23.aop.MethodBeforeAdvice;

import javax.annotation.Nullable;
import java.lang.reflect.Method;

public class AspectJMethodBeforeAdvice extends AbstractAspectJAdvice implements MethodBeforeAdvice {
    public AspectJMethodBeforeAdvice() {

    }

    public AspectJMethodBeforeAdvice(AspectJExpressionPointcut pointcut, Method aspectJAdviceMethod, AspectInstanceFactory aspectInstance) {
        super(pointcut, aspectJAdviceMethod, aspectInstance);
    }

    @Override
    public void before(Method method, Object[] args, @Nullable Object target) throws Throwable {
        invokeAdviceMethod(method, getJoinPointMatch(), null, null, args);
    }

    @Override
    public boolean isBeforeAdvice() {
        return true;
    }

    @Override
    public boolean isAfterAdvice() {
        return false;
    }
}
